How to print all values of Vector[]
Posted
by terence6
on Stack Overflow
See other posts from Stack Overflow
or by terence6
Published on 2010-06-10T20:19:57Z
Indexed on
2010/06/10
20:22 UTC
Read the original article
Hit count: 266
I have a Vector[] of Object type that stores my data. How to print all it's objects ?
The code:
private static Vector<Object[]> vector = new Vector<Object[]>();
int event=0;
for(int i=0; i<10; i++){
vector.add( this.addToObject(System.currentTimeMillis(), event , "String") );
event++;
}
private Object[] addToObject(long t, int i,String s ){
Object[] o = new Object[4];
o[3] = s;
o[2] = i;
o[1] = "00000";
o[0] = t;
return o;
}
printing
public static void main(String[]args){
main m = new Main();
for(int i=0; i< m.vector.size(); i++){
}
}
And I'd like to get sth like this :
1202393057117 1 OOOOO String
1202393057117 2 OOOOO String
1202393057118 3 OOOOO String
1202393057118 4 OOOOO String
1202393057118 5 OOOOO String
© Stack Overflow or respective owner